package com.wisezone.net.client;

import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;

public class ClientDemo {

	public static void main(String[] args) {
		int port = 9527;
		String ip = "192.168.5.6";
		try {
			Socket socket = new Socket(ip,port);
			OutputStream os = socket.getOutputStream();
			
			PrintWriter pw = new PrintWriter(os);
			pw.println("你好！");//发送消息，向socket输出流写入消息
			
			pw.flush(); //刷新流
			
			pw.close();//关闭流
		} catch (UnknownHostException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

}
